<%@ taglib prefix="s" uri="/struts-tags" %>
<%--
  Created by IntelliJ IDEA.
  User: Jam
  Date: 2018/2/4
  Time: 17:08
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>addOrEdit</title>
</head>
<body>
<s:form action="doAddOrEdit.action" method="POST" name="adminGroup">
    <s:hidden name="adminGroup.adminGroup.id"/>
    <%--如果不加这个隐藏标签, 就会导致status属性为null--%>
    <s:hidden name="adminGroup.status"/>
    <s:textfield label="用户组名称" name="adminGroup.title"/>
    <s:select label="父级用户组" list="%{#request.pids}" name="adminGroup.pid"/>
    <s:textfield label="备注" name="adminGroupVO.adminGroup.remark"/>
    <%--<s:checkboxlist label="权限分配" list="%{#request.rules}" name="adminGroupVO.ruleArray"/>--%>
    <p>权限分配: </p>
    <s:iterator value="#request.rules" var="i">
        <s:if test="#i.level == 1">
            <blockquote>
                <input type="checkbox" value="${i.id}" name="adminGroupVO.ruleArray"
                        <s:iterator value="#request.adminGroupVO.ruleArray" var="j">
                            <s:if test="#i.id == #j">
                                checked = "checked"
                            </s:if>
                        </s:iterator>
                />
                    ${i.title}
            </blockquote>
        </s:if>

        <s:if test="#i.level == 2">
            <blockquote>
                <blockquote>
                    <input type="checkbox" value="${i.id}" name="adminGroupVO.ruleArray"
                            <s:iterator value="#request.adminGroupVO.ruleArray" var="j">
                                <s:if test="#i.id == #j">
                                    checked = "checked"
                                </s:if>
                            </s:iterator>
                    />
                        ${i.title}
                </blockquote>
            </blockquote>
        </s:if>

        <s:if test="#i.level == 3">
            <blockquote>
                <blockquote>
                    <blockquote>
                        <input type="checkbox" value="${i.id}" name="adminGroupVO.ruleArray"
                                <s:iterator value="#request.adminGroupVO.ruleArray" var="j">
                                    <s:if test="#i.id == #j">
                                        checked = "checked"
                                    </s:if>
                                </s:iterator>
                        />
                            ${i.title}
                    </blockquote>
                </blockquote>
            </blockquote>
        </s:if>

    </s:iterator>
    <s:submit value="提交"/>
</s:form>
</body>
</html>
